#pragma once
/*!
 * \file 
 * CtrlButton.h
 */


// CCtrlButton
/*!
 * \brief Image push button
 *
 * class for image button
 *
 * - header file: CtrlButton.h
 * - lib: control.lib
 * - DLL: control.dll
 */

class AFX_EXT_CLASS CCtrlButton : public CWnd
{
	DECLARE_DYNAMIC(CCtrlButton)

private:
	int		m_nBitmapUp;				
	int		m_nBitmapDown;		
	int		m_nBitmapDisable;	

	BOOL	m_bButtonDown;	
	BOOL	m_bClientArea;	
	BOOL	m_bEnabled;		

	int		m_nBitmapOver;
	BOOL	m_bHover;
	BOOL	m_bTracking;

	int	m_nSetBitmap;

	HBITMAP m_hBmpUp;
	HBITMAP m_hBmpDown;
	HBITMAP m_hBmpDisable;
	HBITMAP m_hBmpOver;

	CBitmap m_BitmapUp;
	CBitmap m_BitmapDown;
	CBitmap m_BitmapDisable;
	CBitmap m_BitmapOver;

	void DeleteBitmapObject();
public:
	CCtrlButton();
	virtual ~CCtrlButton();

	void SetBitmaps(int nBitmapUp, int nBitmapDown, int nBitmapDisable, int nBitmapOver = 0);
	void SetBitmaps(HBITMAP hbmpUp, HBITMAP hBmpDown, HBITMAP hBmpDisable, HBITMAP hBmpOver);
	/*!
	 * Set bitmap handle.
	 * 
	 * @param number
	 *
	 *	number = 0 : image in normal status
	 *	number = 1 : image in focus
	 *	number = 2 : image selected
	 *	number = 3 : image disabled
	 *
	 * @param hBitmap Handle of bitmap
	 */
	void SetBitmaps(int number, HBITMAP hBitmap);

protected:
	afx_msg void OnPaint();
	afx_msg void OnEnable(BOOL bEnable);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);

	afx_msg LRESULT OnMouseHover(WPARAM wparam, LPARAM lparam);
	afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
	DECLARE_MESSAGE_MAP()
};


